package com.can.controller;

import org.springframework.beans.BeanUtils;

/**
 * @Desription 基础控制器
 * @Author can
 * @Date 2018/10/23
 * @Version 1.0
 */
public abstract class BaseController<T> {
    /**
     * 获取数据库实体
     * @param resourceDTO
     * @return
     */
    public T getEntity(Object resourceDTO,Class<T> clazz) throws IllegalAccessException, InstantiationException {
        T object = clazz.newInstance();
        BeanUtils.copyProperties(resourceDTO, object);
        return object;
    }
}
